home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 123 / cdrom123.iso / essenc / extens / imzoom / Image Zoom.xpi / chrome / imagezoom.jar / content / options.js < prev    next >
Encoding:
JavaScript  |  2004-08-18  |  6.3 KB  |  126 lines

  1. /* ***** BEGIN LICENSE BLOCK *****
  2.  
  3.     Copyright (c) 2004  Jason Adams <jason_nospam@yellowgorilla.net>
  4.  
  5.     This file is part of Image Zoom.
  6.  
  7.     Image Zoom is free software; you can redistribute it and/or modify
  8.     it under the terms of the GNU General Public License as published by
  9.     the Free Software Foundation; either version 2 of the License, or
  10.     (at your option) any later version.
  11.  
  12.     Image Zoom is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.     GNU General Public License for more details.
  16.  
  17.     You should have received a copy of the GNU General Public License
  18.     along with Image Zoom; if not, write to the Free Software
  19.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20.  
  21.  * ***** END LICENSE BLOCK ***** */
  22. var gData;
  23.  
  24. function init(){
  25.     var prefWindow = parent.hPrefWindow;
  26.  
  27.     gData = prefWindow.wsm.dataManager.pageData["chrome://imagezoom/content/optionsmoz.xul"];
  28.  
  29.     if ("imagezoomData" in gData)
  30.         return;
  31.  
  32.     var imagezoomData = {};
  33.     imagezoomData[0] = imagezoomPrefs.getBoolPref("mmZoomIO");
  34.     imagezoomData[1] = imagezoomPrefs.getBoolPref("mmReset");
  35.     imagezoomData[2] = imagezoomPrefs.getBoolPref("mmCustomZoom");
  36.     imagezoomData[3] = imagezoomPrefs.getBoolPref("mmCustomDim");
  37.     imagezoomData[4] = imagezoomPrefs.getBoolPref("mmFitWindow");
  38.     imagezoomData[5] = imagezoomPrefs.getBoolPref("mmZoomPcts");
  39.  
  40.     imagezoomData[6] = imagezoomPrefs.getBoolPref("smZoomIO");
  41.     imagezoomData[7] = imagezoomPrefs.getBoolPref("smReset");
  42.     imagezoomData[8] = imagezoomPrefs.getBoolPref("smCustomZoom");
  43.     imagezoomData[9] = imagezoomPrefs.getBoolPref("smCustomDim");
  44.     imagezoomData[10] = imagezoomPrefs.getBoolPref("smFitWindow");
  45.     imagezoomData[11] = imagezoomPrefs.getBoolPref("smZoomPcts");
  46.  
  47.     imagezoomData[12] = imagezoomPrefs.getBoolPref("usescroll");
  48.     imagezoomData[13] = imagezoomPrefs.getIntPref("scrollvalue");
  49.  
  50.     imagezoomData[14] = imagezoomPrefs.getIntPref("zoomvalue");
  51.     imagezoomData[15] = imagezoomPrefs.getBoolPref("autocenter");
  52.  
  53.     // Initialise dictionarysearchData here
  54.     gData.imagezoomData = imagezoomData;
  55.  
  56.     imagezoom_toggleScrollEnabled();
  57. }
  58.  
  59. function imagezoom_saveOptions()
  60. {
  61.     imagezoomPrefs.setBoolPref("mmZoomIO", document.getElementById("imagezoommmZoomIO").checked);
  62.     imagezoomPrefs.setBoolPref("mmReset", document.getElementById("imagezoommmReset").checked);
  63.     imagezoomPrefs.setBoolPref("mmCustomZoom", document.getElementById("imagezoommmCustomZoom").checked);
  64.     imagezoomPrefs.setBoolPref("mmCustomDim", document.getElementById("imagezoommmCustomDim").checked);
  65.     imagezoomPrefs.setBoolPref("mmFitWindow", document.getElementById("imagezoommmFitWindow").checked);
  66.     imagezoomPrefs.setBoolPref("mmZoomPcts", document.getElementById("imagezoommmZoomPcts").checked);
  67.  
  68.     imagezoomPrefs.setBoolPref("smZoomIO", document.getElementById("imagezoomsmZoomIO").checked);
  69.     imagezoomPrefs.setBoolPref("smReset", document.getElementById("imagezoomsmReset").checked);
  70.     imagezoomPrefs.setBoolPref("smCustomZoom", document.getElementById("imagezoomsmCustomZoom").checked);
  71.     imagezoomPrefs.setBoolPref("smCustomDim", document.getElementById("imagezoomsmCustomDim").checked);
  72.     imagezoomPrefs.setBoolPref("smFitWindow", document.getElementById("imagezoomsmFitWindow").checked);
  73.     imagezoomPrefs.setBoolPref("smZoomPcts", document.getElementById("imagezoomsmZoomPcts").checked);
  74.  
  75.     imagezoomPrefs.setBoolPref("usescroll", document.getElementById("imagezoomusescroll").checked);
  76.     imagezoomPrefs.setIntPref("scrollvalue", document.getElementById("imagezoomscrollvalue").value);
  77.  
  78.     imagezoomPrefs.setIntPref("zoomvalue", document.getElementById("imagezoomzoomvalue").value);
  79.     imagezoomPrefs.setBoolPref("autocenter", document.getElementById("imagezoomautocenter").checked);
  80. }
  81.  
  82. function Startup()
  83. {
  84.     init();
  85. }
  86.  
  87. //Initialize options
  88. function imagezoom_initializeOptions()
  89. {
  90.  
  91.  
  92.     document.getElementById("imagezoommmZoomIO").checked = imagezoomPrefs.getBoolPref("mmZoomIO");
  93.     document.getElementById("imagezoommmReset").checked = imagezoomPrefs.getBoolPref("mmReset");
  94.     document.getElementById("imagezoommmCustomZoom").checked = imagezoomPrefs.getBoolPref("mmCustomZoom");
  95.     document.getElementById("imagezoommmCustomDim").checked = imagezoomPrefs.getBoolPref("mmCustomDim");
  96.     document.getElementById("imagezoommmFitWindow").checked = imagezoomPrefs.getBoolPref("mmFitWindow");
  97.     document.getElementById("imagezoommmZoomPcts").checked = imagezoomPrefs.getBoolPref("mmZoomPcts");
  98.  
  99.     document.getElementById("imagezoomsmZoomIO").checked = imagezoomPrefs.getBoolPref("smZoomIO");
  100.     document.getElementById("imagezoomsmReset").checked = imagezoomPrefs.getBoolPref("smReset");
  101.     document.getElementById("imagezoomsmCustomZoom").checked = imagezoomPrefs.getBoolPref("smCustomZoom");
  102.     document.getElementById("imagezoomsmCustomDim").checked = imagezoomPrefs.getBoolPref("smCustomDim")
  103.     document.getElementById("imagezoomsmFitWindow").checked = imagezoomPrefs.getBoolPref("smFitWindow");
  104.     document.getElementById("imagezoomsmZoomPcts").checked = imagezoomPrefs.getBoolPref("smZoomPcts");
  105.  
  106.     document.getElementById("imagezoomusescroll").checked = imagezoomPrefs.getBoolPref("usescroll");
  107.  
  108.     var scroll = imagezoomPrefs.getIntPref("scrollvalue");
  109.     var scrollValueBox = document.getElementById("imagezoomscrollvalue");
  110.     scrollValueBox.selectedItem = scrollValueBox.getElementsByAttribute( "value", scroll )[0];
  111.     imagezoom_toggleScrollEnabled();
  112.  
  113.     var zoom = imagezoomPrefs.getIntPref("zoomvalue");
  114.     var zoomValueBox = document.getElementById("imagezoomzoomvalue");
  115.     zoomValueBox.selectedItem = zoomValueBox.getElementsByAttribute( "value", zoom )[0];
  116.  
  117.     document.getElementById("imagezoomautocenter").checked = imagezoomPrefs.getBoolPref("autocenter");
  118. }
  119.  
  120. function imagezoom_toggleScrollEnabled()
  121. {
  122.     var scrollDisabled = !document.getElementById("imagezoomusescroll").checked;
  123.     document.getElementById("imagezoomscrollvalue").disabled = scrollDisabled;
  124.     document.getElementById("imagezoomscrollvaluelabelbefore").disabled = scrollDisabled;
  125.     document.getElementById("imagezoomscrollvaluelabelafter").disabled = scrollDisabled;
  126. }